package com.cyy.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

@Service
public class RpcServiceHandler {

    private Map<String,RpcService> rpcServiceMap = new HashMap<>();

    @Autowired
    private RpcService [] rpcServices;


    @PostConstruct
    private void init(){
        if(rpcServices != null || rpcServices.length > 0){
            for(RpcService item : rpcServices){
                System.out.println("coin="+item.getName());
                rpcServiceMap.put(item.getName(),item);
            }
        }
    }


    public  RpcService getByName(String name){
        return rpcServiceMap.get(name);
    }

}
